        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>matcher Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="favicon.ico">
        
        </head>
        <body data-library="matcher">
        <div class="page">
        <div class="header">
          <a href="index.html"><div class="logo"></div></a>
          <a href="index.html">Dart Documentation</a>
         &rsaquo; <a href="matcher.html">matcher</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
<h2><strong>matcher</strong> library</h2>
<div class="doc"><p>The matcher library provides a 3rd generation assertion mechanism, drawing
inspiration from <code>Hamcrest</code> and Ladislav Thon's <code>dart-matchers</code>
library.</p>
<p>See <code>Hamcrest</code> http://en.wikipedia.org/wiki/Hamcrest</p>
<pre><span class="p ">[</span><span class="t ">Hamcrest</span><span class="p ">]</span> <span class="i ">http</span><span class="p ">:</span><span class="c ">//code.google.com/p/hamcrest/</span>
<span class="p ">[</span><span class="i ">dart</span><span class="o ">-</span><span class="i ">matchers</span><span class="p ">]</span> <span class="i ">https</span><span class="p ">:</span><span class="c ">//github.com/Ladicek/dart-matchers</span></pre></div>
<div>
<h3>Properties</h3>
<div class="field"><h4 id="anything">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>anything</strong> <a class="anchor-link"
            href="#anything"
            title="Permalink to anything">#</a>
        </h4>
        <div class="doc">
<pre class="source">
anything = const _IsAnything()
</pre>
</div>
</div>
<div class="field"><h4 id="completes">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a>         <strong>completes</strong> <a class="anchor-link"
            href="#completes"
            title="Permalink to completes">#</a>
        </h4>
        <div class="doc">
<pre class="source">
completes = const _Completes(null, '')
</pre>
</div>
</div>
<div class="field"><h4 id="isArgumentError">
<button class="show-code">Code</button>
const         <strong>isArgumentError</strong> <a class="anchor-link"
            href="#isArgumentError"
            title="Permalink to isArgumentError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isArgumentError = const _ArgumentError()
</pre>
</div>
</div>
<div class="field"><h4 id="isEmpty">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isEmpty</strong> <a class="anchor-link"
            href="#isEmpty"
            title="Permalink to isEmpty">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isEmpty = const _Empty()
</pre>
</div>
</div>
<div class="field"><h4 id="isException">
<button class="show-code">Code</button>
const         <strong>isException</strong> <a class="anchor-link"
            href="#isException"
            title="Permalink to isException">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isException = const _Exception()
</pre>
</div>
</div>
<div class="field"><h4 id="isFalse">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isFalse</strong> <a class="anchor-link"
            href="#isFalse"
            title="Permalink to isFalse">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isFalse = const _IsFalse()
</pre>
</div>
</div>
<div class="field"><h4 id="isFormatException">
<button class="show-code">Code</button>
const         <strong>isFormatException</strong> <a class="anchor-link"
            href="#isFormatException"
            title="Permalink to isFormatException">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isFormatException = const _FormatException()
</pre>
</div>
</div>
<div class="field"><h4 id="isList">
<button class="show-code">Code</button>
const         <strong>isList</strong> <a class="anchor-link"
            href="#isList"
            title="Permalink to isList">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isList = const _IsList()
</pre>
</div>
</div>
<div class="field"><h4 id="isMap">
<button class="show-code">Code</button>
const         <strong>isMap</strong> <a class="anchor-link"
            href="#isMap"
            title="Permalink to isMap">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isMap = const _IsMap()
</pre>
</div>
</div>
<div class="field"><h4 id="isNegative">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isNegative</strong> <a class="anchor-link"
            href="#isNegative"
            title="Permalink to isNegative">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isNegative =
const _OrderingComparison(0, false, true, false, 'a negative value', false)
</pre>
</div>
</div>
<div class="field"><h4 id="isNonNegative">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isNonNegative</strong> <a class="anchor-link"
            href="#isNonNegative"
            title="Permalink to isNonNegative">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isNonNegative =
const _OrderingComparison(0, true, false, true,
'a non-negative value', false)
</pre>
</div>
</div>
<div class="field"><h4 id="isNonPositive">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isNonPositive</strong> <a class="anchor-link"
            href="#isNonPositive"
            title="Permalink to isNonPositive">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isNonPositive =
const _OrderingComparison(0, true, true, false,
'a non-positive value', false)
</pre>
</div>
</div>
<div class="field"><h4 id="isNonZero">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isNonZero</strong> <a class="anchor-link"
            href="#isNonZero"
            title="Permalink to isNonZero">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isNonZero =
const _OrderingComparison(0, false, true, true, 'a value not equal to')
</pre>
</div>
</div>
<div class="field"><h4 id="isNoSuchMethodError">
<button class="show-code">Code</button>
const         <strong>isNoSuchMethodError</strong> <a class="anchor-link"
            href="#isNoSuchMethodError"
            title="Permalink to isNoSuchMethodError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isNoSuchMethodError = const _NoSuchMethodError()
</pre>
</div>
</div>
<div class="field"><h4 id="isNotNull">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isNotNull</strong> <a class="anchor-link"
            href="#isNotNull"
            title="Permalink to isNotNull">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isNotNull = const _IsNotNull()
</pre>
</div>
</div>
<div class="field"><h4 id="isNull">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isNull</strong> <a class="anchor-link"
            href="#isNull"
            title="Permalink to isNull">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isNull = const _IsNull()
</pre>
</div>
</div>
<div class="field"><h4 id="isPositive">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isPositive</strong> <a class="anchor-link"
            href="#isPositive"
            title="Permalink to isPositive">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isPositive =
const _OrderingComparison(0, false, false, true, 'a positive value', false)
</pre>
</div>
</div>
<div class="field"><h4 id="isRangeError">
<button class="show-code">Code</button>
const         <strong>isRangeError</strong> <a class="anchor-link"
            href="#isRangeError"
            title="Permalink to isRangeError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isRangeError = const _RangeError()
</pre>
</div>
</div>
<div class="field"><h4 id="isStateError">
<button class="show-code">Code</button>
const         <strong>isStateError</strong> <a class="anchor-link"
            href="#isStateError"
            title="Permalink to isStateError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isStateError = const _StateError()
</pre>
</div>
</div>
<div class="field"><h4 id="isTrue">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isTrue</strong> <a class="anchor-link"
            href="#isTrue"
            title="Permalink to isTrue">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isTrue = const _IsTrue()
</pre>
</div>
</div>
<div class="field"><h4 id="isUnimplementedError">
<button class="show-code">Code</button>
const         <strong>isUnimplementedError</strong> <a class="anchor-link"
            href="#isUnimplementedError"
            title="Permalink to isUnimplementedError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isUnimplementedError = const _UnimplementedError()
</pre>
</div>
</div>
<div class="field"><h4 id="isUnsupportedError">
<button class="show-code">Code</button>
const         <strong>isUnsupportedError</strong> <a class="anchor-link"
            href="#isUnsupportedError"
            title="Permalink to isUnsupportedError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isUnsupportedError = const _UnsupportedError()
</pre>
</div>
</div>
<div class="field"><h4 id="isZero">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>isZero</strong> <a class="anchor-link"
            href="#isZero"
            title="Permalink to isZero">#</a>
        </h4>
        <div class="doc">
<pre class="source">
isZero =
const _OrderingComparison(0, true, false, false, 'a value equal to')
</pre>
</div>
</div>
<div class="field"><h4 id="returnsNormally">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>returnsNormally</strong> <a class="anchor-link"
            href="#returnsNormally"
            title="Permalink to returnsNormally">#</a>
        </h4>
        <div class="doc">
<pre class="source">
returnsNormally = const _ReturnsNormally()
</pre>
</div>
</div>
<div class="field"><h4 id="throws">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>throws</strong> <a class="anchor-link"
            href="#throws"
            title="Permalink to throws">#</a>
        </h4>
        <div class="doc">
<pre class="source">
throws = const Throws()
</pre>
</div>
</div>
<div class="field"><h4 id="throwsArgumentError">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>throwsArgumentError</strong> <a class="anchor-link"
            href="#throwsArgumentError"
            title="Permalink to throwsArgumentError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
throwsArgumentError =
const Throws(isArgumentError)
</pre>
</div>
</div>
<div class="field"><h4 id="throwsException">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>throwsException</strong> <a class="anchor-link"
            href="#throwsException"
            title="Permalink to throwsException">#</a>
        </h4>
        <div class="doc">
<pre class="source">
throwsException = const Throws(isException)
</pre>
</div>
</div>
<div class="field"><h4 id="throwsFormatException">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>throwsFormatException</strong> <a class="anchor-link"
            href="#throwsFormatException"
            title="Permalink to throwsFormatException">#</a>
        </h4>
        <div class="doc">
<pre class="source">
throwsFormatException =
const Throws(isFormatException)
</pre>
</div>
</div>
<div class="field"><h4 id="throwsNoSuchMethodError">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>throwsNoSuchMethodError</strong> <a class="anchor-link"
            href="#throwsNoSuchMethodError"
            title="Permalink to throwsNoSuchMethodError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
throwsNoSuchMethodError =
const Throws(isNoSuchMethodError)
</pre>
</div>
</div>
<div class="field"><h4 id="throwsRangeError">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>throwsRangeError</strong> <a class="anchor-link"
            href="#throwsRangeError"
            title="Permalink to throwsRangeError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
throwsRangeError =
const Throws(isRangeError)
</pre>
</div>
</div>
<div class="field"><h4 id="throwsStateError">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>throwsStateError</strong> <a class="anchor-link"
            href="#throwsStateError"
            title="Permalink to throwsStateError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
throwsStateError =
const Throws(isStateError)
</pre>
</div>
</div>
<div class="field"><h4 id="throwsUnimplementedError">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>throwsUnimplementedError</strong> <a class="anchor-link"
            href="#throwsUnimplementedError"
            title="Permalink to throwsUnimplementedError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
throwsUnimplementedError =
const Throws(isUnimplementedError)
</pre>
</div>
</div>
<div class="field"><h4 id="throwsUnsupportedError">
<button class="show-code">Code</button>
const <a href="matcher/Matcher.html">Matcher</a>         <strong>throwsUnsupportedError</strong> <a class="anchor-link"
            href="#throwsUnsupportedError"
            title="Permalink to throwsUnsupportedError">#</a>
        </h4>
        <div class="doc">
<pre class="source">
throwsUnsupportedError = const Throws(isUnsupportedError)
</pre>
</div>
</div>
<div class="field"><h4 id="wrapAsync">
<button class="show-code">Code</button>
Function         <strong>wrapAsync</strong> <a class="anchor-link"
            href="#wrapAsync"
            title="Permalink to wrapAsync">#</a>
        </h4>
        <div class="doc">
<pre class="source">
wrapAsync = (f, [id]) =&gt; f
</pre>
</div>
</div>
</div>
<div>
<h3>Functions</h3>
<div class="method"><h4 id="matches">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>matches</strong>(re) <a class="anchor-link" href="#matches"
              title="Permalink to matches">#</a></h4>
<div class="doc">
<p>Returns a matcher that matches if the match argument is a string and
matches the regular expression given by 
<span class="param">re</span>. 
<span class="param">re</span> can be a RegExp
instance or a string; in the latter case it will be used to create
a RegExp instance.</p>
<pre class="source">
Matcher matches(re) =&gt; new _MatchesRegExp(re);
</pre>
</div>
</div>
<div class="method"><h4 id="stringContainsInOrder">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>stringContainsInOrder</strong>(substrings) <a class="anchor-link" href="#stringContainsInOrder"
              title="Permalink to stringContainsInOrder">#</a></h4>
<div class="doc">
<p>Returns a matcher that matches if the match argument is a string and
contains a given list of 
<span class="param">substrings</span> in relative order.</p>
<p>For example, <code>stringContainsInOrder(["a", "e", "i", "o", "u"])</code> will match
"abcdefghijklmnopqrstuvwxyz".</p>
<pre class="source">
Matcher stringContainsInOrder(substrings) =&gt;
   new _StringContainsInOrder(substrings);
</pre>
</div>
</div>
<div class="method"><h4 id="endsWith">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>endsWith</strong>(String suffixString) <a class="anchor-link" href="#endsWith"
              title="Permalink to endsWith">#</a></h4>
<div class="doc">
<p>Returns a matcher that matches if the match argument is a string and
ends with 
<span class="param">suffixString</span>.</p>
<pre class="source">
Matcher endsWith(String suffixString) =&gt; new _StringEndsWith(suffixString);
</pre>
</div>
</div>
<div class="method"><h4 id="startsWith">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>startsWith</strong>(String prefixString) <a class="anchor-link" href="#startsWith"
              title="Permalink to startsWith">#</a></h4>
<div class="doc">
<p>Returns a matcher that matches if the match argument is a string and
starts with 
<span class="param">prefixString</span>.</p>
<pre class="source">
Matcher startsWith(String prefixString) =&gt; new _StringStartsWith(prefixString);
</pre>
</div>
</div>
<div class="method"><h4 id="collapseWhitespace">
<button class="show-code">Code</button>
String <strong>collapseWhitespace</strong>(_string) <a class="anchor-link" href="#collapseWhitespace"
              title="Permalink to collapseWhitespace">#</a></h4>
<div class="doc">
<p>Utility function to collapse whitespace runs to single spaces
and strip leading/trailing whitespace.</p>
<pre class="source">
String collapseWhitespace(_string) {
 bool isWhitespace(String ch) =&gt; (' \n\r\t'.indexOf(ch) &gt;= 0);
 StringBuffer result = new StringBuffer();
 bool skipSpace = true;
 for (var i = 0; i &lt; _string.length; i++) {
   var character = _string[i];
   if (isWhitespace(character)) {
     if (!skipSpace) {
       result.write(' ');
       skipSpace = true;
     }
   } else {
     result.write(character);
     skipSpace = false;
   }
 }
 return result.toString().trim();
}
</pre>
</div>
</div>
<div class="method"><h4 id="equalsIgnoringWhitespace">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>equalsIgnoringWhitespace</strong>(_string) <a class="anchor-link" href="#equalsIgnoringWhitespace"
              title="Permalink to equalsIgnoringWhitespace">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is a string and
is equal to <code>value</code> when compared with all runs of whitespace
collapsed to single spaces and leading and trailing whitespace removed.</p>
<p>For example, <code>equalsIgnoringCase("hello world")</code> will match
"hello   world", "  hello world" and "hello world  ".</p>
<pre class="source">
Matcher equalsIgnoringWhitespace(_string) =&gt;
   new _IsEqualIgnoringWhitespace(_string);
</pre>
</div>
</div>
<div class="method"><h4 id="equalsIgnoringCase">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>equalsIgnoringCase</strong>(String value) <a class="anchor-link" href="#equalsIgnoringCase"
              title="Permalink to equalsIgnoringCase">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is a string and
is equal to 
<span class="param">value</span> when compared case-insensitively.</p>
<pre class="source">
Matcher equalsIgnoringCase(String value) =&gt; new _IsEqualIgnoringCase(value);
</pre>
</div>
</div>
<div class="method"><h4 id="anyOf">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>anyOf</strong>(arg0, [arg1 = null, arg2 = null, arg3 = null, arg4 = null, arg5 = null, arg6 = null]) <a class="anchor-link" href="#anyOf"
              title="Permalink to anyOf">#</a></h4>
<div class="doc">
<p>Matches if any of the given matchers evaluate to true. The
arguments can be a set of matchers as separate parameters
(up to 7), or a List of matchers.</p>
<p>The matchers are evaluated from left to right using short-circuit
evaluation, so evaluation stops as soon as a matcher returns true.</p>
<p>Any argument that is not a matcher is implicitly wrapped in a
Matcher to check for equality.</p>
<pre class="source">
Matcher anyOf(arg0,
              [arg1 = null,
               arg2 = null,
               arg3 = null,
               arg4 = null,
               arg5 = null,
               arg6 = null]) {
 if (arg0 is List) {
   expect(arg1, isNull);
   expect(arg2, isNull);
   expect(arg3, isNull);
   expect(arg4, isNull);
   expect(arg5, isNull);
   expect(arg6, isNull);
   for (int i = 0; i &lt; arg0.length; i++) {
     arg0[i] = wrapMatcher(arg0[i]);
   }
   return new _AnyOf(arg0);
 } else {
   List matchers = new List();
   if (arg0 != null) {
     matchers.add(wrapMatcher(arg0));
   }
   if (arg1 != null) {
     matchers.add(wrapMatcher(arg1));
   }
   if (arg2 != null) {
     matchers.add(wrapMatcher(arg2));
   }
   if (arg3 != null) {
     matchers.add(wrapMatcher(arg3));
   }
   if (arg4 != null) {
     matchers.add(wrapMatcher(arg4));
   }
   if (arg5 != null) {
     matchers.add(wrapMatcher(arg5));
   }
   if (arg6 != null) {
     matchers.add(wrapMatcher(arg6));
   }
   return new _AnyOf(matchers);
 }
}
</pre>
</div>
</div>
<div class="method"><h4 id="allOf">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>allOf</strong>(arg0, [arg1 = null, arg2 = null, arg3 = null, arg4 = null, arg5 = null, arg6 = null]) <a class="anchor-link" href="#allOf"
              title="Permalink to allOf">#</a></h4>
<div class="doc">
<p>This returns a matcher that matches if all of the matchers passed as
arguments (up to 7) match. Instead of passing the matchers separately
they can be passed as a single List argument.
Any argument that is not a matcher is implicitly wrapped in a
Matcher to check for equality.</p>
<pre class="source">
Matcher allOf(arg0,
            [arg1 = null,
             arg2 = null,
             arg3 = null,
             arg4 = null,
             arg5 = null,
             arg6 = null]) {
 if (arg0 is List) {
   expect(arg1, isNull);
   expect(arg2, isNull);
   expect(arg3, isNull);
   expect(arg4, isNull);
   expect(arg5, isNull);
   expect(arg6, isNull);
   for (int i = 0; i &lt; arg0.length; i++) {
     arg0[i] = wrapMatcher(arg0[i]);
   }
   return new _AllOf(arg0);
 } else {
   List matchers = new List();
   if (arg0 != null) {
     matchers.add(wrapMatcher(arg0));
   }
   if (arg1 != null) {
     matchers.add(wrapMatcher(arg1));
   }
   if (arg2 != null) {
     matchers.add(wrapMatcher(arg2));
   }
   if (arg3 != null) {
     matchers.add(wrapMatcher(arg3));
   }
   if (arg4 != null) {
     matchers.add(wrapMatcher(arg4));
   }
   if (arg5 != null) {
     matchers.add(wrapMatcher(arg5));
   }
   if (arg6 != null) {
     matchers.add(wrapMatcher(arg6));
   }
   return new _AllOf(matchers);
 }
}
</pre>
</div>
</div>
<div class="method"><h4 id="isNot">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>isNot</strong>(matcher) <a class="anchor-link" href="#isNot"
              title="Permalink to isNot">#</a></h4>
<div class="doc">
<p>This returns a matcher that inverts 
<span class="param">matcher</span> to its logical negation.</p>
<pre class="source">
Matcher isNot(matcher) =&gt; new _IsNot(wrapMatcher(matcher));
</pre>
</div>
</div>
<div class="method"><h4 id="inClosedOpenRange">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>inClosedOpenRange</strong>(low, high) <a class="anchor-link" href="#inClosedOpenRange"
              title="Permalink to inClosedOpenRange">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is greater
than or equal to a 
<span class="param">low</span> and less than 
<span class="param">high</span>.</p>
<pre class="source">
Matcher inClosedOpenRange(low, high) =&gt; new _InRange(low, high, true, false);
</pre>
</div>
</div>
<div class="method"><h4 id="inOpenClosedRange">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>inOpenClosedRange</strong>(low, high) <a class="anchor-link" href="#inOpenClosedRange"
              title="Permalink to inOpenClosedRange">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is greater
than 
<span class="param">low</span> and less than or equal to 
<span class="param">high</span>.</p>
<pre class="source">
Matcher inOpenClosedRange(low, high) =&gt; new _InRange(low, high, false, true);
</pre>
</div>
</div>
<div class="method"><h4 id="inExclusiveRange">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>inExclusiveRange</strong>(low, high) <a class="anchor-link" href="#inExclusiveRange"
              title="Permalink to inExclusiveRange">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is greater
than 
<span class="param">low</span> and less than 
<span class="param">high</span>.</p>
<pre class="source">
Matcher inExclusiveRange(low, high) =&gt; new _InRange(low, high, false, false);
</pre>
</div>
</div>
<div class="method"><h4 id="inInclusiveRange">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>inInclusiveRange</strong>(low, high) <a class="anchor-link" href="#inInclusiveRange"
              title="Permalink to inInclusiveRange">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is greater
than or equal to 
<span class="param">low</span> and less than or equal to 
<span class="param">high</span>.</p>
<pre class="source">
Matcher inInclusiveRange(low, high) =&gt; new _InRange(low, high, true, true);
</pre>
</div>
</div>
<div class="method"><h4 id="closeTo">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>closeTo</strong>(value, delta) <a class="anchor-link" href="#closeTo"
              title="Permalink to closeTo">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is within 
<span class="param">delta</span>
of some 
<span class="param">value</span>; i.e. if the match argument is greater than
than or equal 
<span class="param">value</span>-
<span class="param">delta</span> and less than or equal to 
<span class="param">value</span>+
<span class="param">delta</span>.</p>
<pre class="source">
Matcher closeTo(value, delta) =&gt; new _IsCloseTo(value, delta);
</pre>
</div>
</div>
<div class="method"><h4 id="lessThanOrEqualTo">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>lessThanOrEqualTo</strong>(value) <a class="anchor-link" href="#lessThanOrEqualTo"
              title="Permalink to lessThanOrEqualTo">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is less
than or equal to the given 
<span class="param">value</span>.</p>
<pre class="source">
Matcher lessThanOrEqualTo(value) =&gt;
 new _OrderingComparison(value, true, true, false,
     'a value less than or equal to');
</pre>
</div>
</div>
<div class="method"><h4 id="lessThan">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>lessThan</strong>(value) <a class="anchor-link" href="#lessThan"
              title="Permalink to lessThan">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is less
than the given 
<span class="param">value</span>.</p>
<pre class="source">
Matcher lessThan(value) =&gt;
 new _OrderingComparison(value, false, true, false, 'a value less than');
</pre>
</div>
</div>
<div class="method"><h4 id="greaterThanOrEqualTo">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>greaterThanOrEqualTo</strong>(value) <a class="anchor-link" href="#greaterThanOrEqualTo"
              title="Permalink to greaterThanOrEqualTo">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is greater
than or equal to the given 
<span class="param">value</span>.</p>
<pre class="source">
Matcher greaterThanOrEqualTo(value) =&gt;
 new _OrderingComparison(value, true, false, true,
     'a value greater than or equal to');
</pre>
</div>
</div>
<div class="method"><h4 id="greaterThan">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>greaterThan</strong>(value) <a class="anchor-link" href="#greaterThan"
              title="Permalink to greaterThan">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches if the match argument is greater
than the given 
<span class="param">value</span>.</p>
<pre class="source">
Matcher greaterThan(value) =&gt;
 new _OrderingComparison(value, false, false, true, 'a value greater than');
</pre>
</div>
</div>
<div class="method"><h4 id="containsPair">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>containsPair</strong>(key, value) <a class="anchor-link" href="#containsPair"
              title="Permalink to containsPair">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches maps containing the key-value pair
with 
<span class="param">key</span> => 
<span class="param">value</span>.</p>
<pre class="source">
Matcher containsPair(key, value) =&gt;
   new _ContainsMapping(key, wrapMatcher(value));
</pre>
</div>
</div>
<div class="method"><h4 id="containsValue">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>containsValue</strong>(value) <a class="anchor-link" href="#containsValue"
              title="Permalink to containsValue">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches maps containing the given 
<span class="param">value</span>.</p>
<pre class="source">
Matcher containsValue(value) =&gt; new _ContainsValue(value);
</pre>
</div>
</div>
<div class="method"><h4 id="completion">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>completion</strong>(matcher, [String id = '']) <a class="anchor-link" href="#completion"
              title="Permalink to completion">#</a></h4>
<div class="doc">
<p>Matches a <code>Future</code> that completes succesfully with a value that matches

<span class="param">matcher</span>. Note that this creates an asynchronous expectation. The call to
<code>expect()</code> that includes this will return immediately and execution will
continue. Later, when the future completes, the actual expectation will run.</p>
<p>To test that a Future completes with an exception, you can use <a class="crossref" href="matcher.html#throws">throws</a> and
<a class="crossref" href="matcher.html#throwsA">throwsA</a>.</p>
<p>
<span class="param">id</span> is an optional tag that can be used to identify the completion matcher
in error messages.</p>
<pre class="source">
Matcher completion(matcher, [String id = '']) =&gt;
   new _Completes(wrapMatcher(matcher), id);
</pre>
</div>
</div>
<div class="method"><h4 id="configureExpectFormatter">
<button class="show-code">Code</button>
<a href="matcher/ErrorFormatter.html">ErrorFormatter</a> <strong>configureExpectFormatter</strong>([<a href="matcher/ErrorFormatter.html">ErrorFormatter</a> formatter = null]) <a class="anchor-link" href="#configureExpectFormatter"
              title="Permalink to configureExpectFormatter">#</a></h4>
<div class="doc">
<p>Changes or resets to default the failure message formatter for expect().

<span class="param">formatter</span> is a reference to the new formatter; if this is omitted or
null then the failure formatter is reset to the default. The new
formatter is returned; this allows custom expect handlers to easily
get a reference to the default formatter.</p>
<pre class="source">
ErrorFormatter configureExpectFormatter([ErrorFormatter formatter = null]) {
 if (formatter == null) {
   formatter = _defaultErrorFormatter;
 }
 return _assertErrorFormatter = formatter;
}
</pre>
</div>
</div>
<div class="method"><h4 id="getOrCreateExpectFailureHandler">
<button class="show-code">Code</button>
<a href="matcher/FailureHandler.html">FailureHandler</a> <strong>getOrCreateExpectFailureHandler</strong>() <a class="anchor-link" href="#getOrCreateExpectFailureHandler"
              title="Permalink to getOrCreateExpectFailureHandler">#</a></h4>
<div class="doc">
<pre class="source">
FailureHandler getOrCreateExpectFailureHandler() {
 if (_assertFailureHandler == null) {
   configureExpectFailureHandler();
 }
 return _assertFailureHandler;
}
</pre>
</div>
</div>
<div class="method"><h4 id="configureExpectFailureHandler">
<button class="show-code">Code</button>
void <strong>configureExpectFailureHandler</strong>([<a href="matcher/FailureHandler.html">FailureHandler</a> handler = null]) <a class="anchor-link" href="#configureExpectFailureHandler"
              title="Permalink to configureExpectFailureHandler">#</a></h4>
<div class="doc">
<p>Changes or resets to the default the failure handler for expect()

<span class="param">handler</span> is a reference to the new handler; if this is omitted
or null then the failure handler is reset to the default, which
throws <a class="crossref" href="matcher/TestFailure.html">TestFailure</a>s on <a class="crossref" href="matcher.html#expect">expect</a> assertion failures.</p>
<pre class="source">
void configureExpectFailureHandler([FailureHandler handler = null]) {
 if (handler == null) {
   handler = new DefaultFailureHandler();
 }
 _assertFailureHandler = handler;
}
</pre>
</div>
</div>
<div class="method"><h4 id="wrapMatcher">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>wrapMatcher</strong>(x) <a class="anchor-link" href="#wrapMatcher"
              title="Permalink to wrapMatcher">#</a></h4>
<div class="doc">
<p>Takes an argument and returns an equivalent matcher.
If the argument is already a matcher this does nothing,
else if the argument is a function, it generates a predicate
function matcher, else it generates an equals matcher.</p>
<pre class="source">
Matcher wrapMatcher(x) {
 if (x is Matcher) {
   return x;
 } else if (x is Function) {
   return predicate(x);
 } else {
   return equals(x);
 }
}
</pre>
</div>
</div>
<div class="method"><h4 id="fail">
<button class="show-code">Code</button>
void <strong>fail</strong>(String message, {<a href="matcher/FailureHandler.html">FailureHandler</a> failureHandler}) <a class="anchor-link" href="#fail"
              title="Permalink to fail">#</a></h4>
<div class="doc">
<pre class="source">
void fail(String message, {FailureHandler failureHandler}) {
 if (failureHandler == null) {
   failureHandler = getOrCreateExpectFailureHandler();
 }
 failureHandler.fail(message);
}
</pre>
</div>
</div>
<div class="method"><h4 id="expect">
<button class="show-code">Code</button>
void <strong>expect</strong>(actual, matcher, {String reason, <a href="matcher/FailureHandler.html">FailureHandler</a> failureHandler, bool verbose: false}) <a class="anchor-link" href="#expect"
              title="Permalink to expect">#</a></h4>
<div class="doc">
<p>This is the main assertion function. It asserts that 
<span class="param">actual</span>
matches the 
<span class="param">matcher</span>. 
<span class="param">reason</span> is optional and is typically not
supplied, as a reason is generated from the matcher; if 
<span class="param">reason</span>
is included it is appended to the reason generated by the matcher.</p>
<p>
<span class="param">matcher</span> can be a value in which case it will be wrapped in an
<a class="crossref" href="matcher.html#equals">equals</a> matcher.</p>
<p>If the assertion fails, then the default behavior is to throw a
<a class="crossref" href="matcher/TestFailure.html">TestFailure</a>, but this behavior can be changed by calling
<a class="crossref" href="matcher.html#configureExpectFailureHandler">configureExpectFailureHandler</a> and providing an alternative handler that
implements the <code>IFailureHandler</code> interface. It is also possible to
pass a 
<span class="param">failureHandler</span> to <a class="crossref" href="matcher.html#expect">expect</a> as a final parameter for fine-
grained control.</p>
<p>In some cases extra diagnostic info can be produced on failure (for
example, stack traces on mismatched exceptions). To enable these,

<span class="param">verbose</span> should be specified as true;</p>
<pre class="source">
void expect(actual, matcher, {String reason, FailureHandler failureHandler,
           bool verbose : false}) {
 matcher = wrapMatcher(matcher);
 bool doesMatch;
 var matchState = new MatchState();
 try {
   doesMatch = matcher.matches(actual, matchState);
 } catch (e, trace) {
   doesMatch = false;
   if (reason == null) {
     reason = '${(e is String) ? e : e.toString()} at $trace';
   }
 }
 if (!doesMatch) {
   if (failureHandler == null) {
     failureHandler = getOrCreateExpectFailureHandler();
   }
   failureHandler.failMatch(actual, matcher, reason, matchState, verbose);
 }
}
</pre>
</div>
</div>
<div class="method"><h4 id="predicate">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>predicate</strong>(Function f, [description = 'satisfies function']) <a class="anchor-link" href="#predicate"
              title="Permalink to predicate">#</a></h4>
<div class="doc">
<p>Returns a matcher that uses an arbitrary function that returns
true or false for the actual value. For example:</p>
<pre><span class="i ">expect</span><span class="p ">(</span><span class="i ">v</span><span class="p ">,</span> <span class="i ">predicate</span><span class="p ">(</span><span class="p ">(</span><span class="i ">x</span><span class="p ">)</span> <span class="a ">=&gt;</span> <span class="p ">(</span><span class="p ">(</span><span class="i ">x</span> <span class="o ">%</span> <span class="n ">2</span><span class="p ">)</span> <span class="o ">==</span> <span class="n ">0</span><span class="p ">)</span><span class="p ">,</span> <span class="s si">"is even"</span><span class="p ">)</span><span class="p ">)</span></pre>
<pre class="source">
Matcher predicate(Function f, [description ='satisfies function']) =&gt;
   new _Predicate(f, description);
</pre>
</div>
</div>
<div class="method"><h4 id="isIn">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>isIn</strong>(expected) <a class="anchor-link" href="#isIn"
              title="Permalink to isIn">#</a></h4>
<div class="doc">
<p>Returns a matcher that matches if the match argument is in
the expected value. This is the converse of <a class="crossref" href="matcher.html#contains">contains</a>.</p>
<pre class="source">
Matcher isIn(expected) =&gt; new _In(expected);
</pre>
</div>
</div>
<div class="method"><h4 id="contains">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>contains</strong>(expected) <a class="anchor-link" href="#contains"
              title="Permalink to contains">#</a></h4>
<div class="doc">
<p>Returns a matcher that matches if the match argument contains
the expected value. For <code>String</code>s this means substring matching;
for <code>Map</code>s it means the map has the key, and for <code>Iterable</code>s
(including <code>Collection</code>s) it means the iterable has a matching
element. In the case of iterables, 
<span class="param">expected</span> can itself be a
matcher.</p>
<pre class="source">
Matcher contains(expected) =&gt; new _Contains(expected);
</pre>
</div>
</div>
<div class="method"><h4 id="hasLength">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>hasLength</strong>(matcher) <a class="anchor-link" href="#hasLength"
              title="Permalink to hasLength">#</a></h4>
<div class="doc">
<p>Returns a matcher that matches if an object has a length property
that matches 
<span class="param">matcher</span>.</p>
<pre class="source">
Matcher hasLength(matcher) =&gt;
   new _HasLength(wrapMatcher(matcher));
</pre>
</div>
</div>
<div class="method"><h4 id="throwsA">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>throwsA</strong>(matcher) <a class="anchor-link" href="#throwsA"
              title="Permalink to throwsA">#</a></h4>
<div class="doc">
<p>This can be used to match two kinds of objects:</p><ul><li>
<p>A <code>Function</code> that throws an exception when called. The function cannot
take any arguments. If you want to test that a function expecting
arguments throws, wrap it in another zero-argument function that calls
the one you want to test.</p></li><li>
<p>A <code>Future</code> that completes with an exception. Note that this creates an
asynchronous expectation. The call to <code>expect()</code> that includes this will
return immediately and execution will continue. Later, when the future
completes, the actual expectation will run.</p></li></ul>
<p>In both cases, when an exception is thrown, this will test that the exception
object matches 
<span class="param">matcher</span>. If 
<span class="param">matcher</span> is not an instance of <a class="crossref" href="matcher/Matcher.html">Matcher</a>, it
will implicitly be treated as <code>equals(matcher)</code>.</p>
<pre class="source">
Matcher throwsA(matcher) =&gt; new Throws(wrapMatcher(matcher));
</pre>
</div>
</div>
<div class="method"><h4 id="equals">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>equals</strong>(expected, [limit = 100]) <a class="anchor-link" href="#equals"
              title="Permalink to equals">#</a></h4>
<div class="doc">
<p>Returns a matcher that does a deep recursive match. This only works
with scalars, Maps and Iterables. To handle cyclic structures a
recursion depth 
<span class="param">limit</span> can be provided. The default limit is 100.</p>
<pre class="source">
Matcher equals(expected, [limit=100]) =&gt;
   new _DeepMatcher(expected, limit);
</pre>
</div>
</div>
<div class="method"><h4 id="same">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>same</strong>(expected) <a class="anchor-link" href="#same"
              title="Permalink to same">#</a></h4>
<div class="doc">
<p>Returns a matches that matches if the value is the same instance
as <a href="`===`">object</a>.</p>
<pre class="source">
Matcher same(expected) =&gt; new _IsSameAs(expected);
</pre>
</div>
</div>
<div class="method"><h4 id="unorderedEquals">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>unorderedEquals</strong>(Iterable expected) <a class="anchor-link" href="#unorderedEquals"
              title="Permalink to unorderedEquals">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches <code>Iterable</code>s that have the same
length and the same elements as 
<span class="param">expected</span>, but not necessarily in
the same order. Note that this is O(n^2) so should only be used on
small objects.</p>
<pre class="source">
Matcher unorderedEquals(Iterable expected) =&gt;
   new _UnorderedEquals(expected);
</pre>
</div>
</div>
<div class="method"><h4 id="orderedEquals">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>orderedEquals</strong>(Iterable expected) <a class="anchor-link" href="#orderedEquals"
              title="Permalink to orderedEquals">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches <code>Iterable</code>s that have the same
length and the same elements as 
<span class="param">expected</span>, and in the same order.
This is equivalent to equals but does not recurse.</p>
<pre class="source">
Matcher orderedEquals(Iterable expected) =&gt; new _OrderedEquals(expected);
</pre>
</div>
</div>
<div class="method"><h4 id="someElement">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>someElement</strong>(matcher) <a class="anchor-link" href="#someElement"
              title="Permalink to someElement">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches <code>Collection</code>s in which at least one
element matches the given 
<span class="param">matcher</span>.</p>
<pre class="source">
Matcher someElement(matcher) =&gt; new _SomeElement(wrapMatcher(matcher));
</pre>
</div>
</div>
<div class="method"><h4 id="everyElement">
<button class="show-code">Code</button>
<a href="matcher/Matcher.html">Matcher</a> <strong>everyElement</strong>(matcher) <a class="anchor-link" href="#everyElement"
              title="Permalink to everyElement">#</a></h4>
<div class="doc">
<p>Returns a matcher which matches <code>Collection</code>s in which all elements
match the given 
<span class="param">matcher</span>.</p>
<pre class="source">
Matcher everyElement(matcher) =&gt; new _EveryElement(wrapMatcher(matcher));
</pre>
</div>
</div>
</div>
<div>
<h3>Abstract Classes</h3>
          <div class="type">
          <h4>
            <a href="matcher/BaseMatcher.html"><strong>BaseMatcher</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/Description.html"><strong>Description</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/FailureHandler.html"><strong>FailureHandler</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/Matcher.html"><strong>Matcher</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/TypeMatcher.html"><strong>TypeMatcher</strong></a>
          </h4>
          </div>
          
</div>
<div>
<h3>Classes</h3>
          <div class="type">
          <h4>
            <a href="matcher/CustomMatcher.html"><strong>CustomMatcher</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/DefaultFailureHandler.html"><strong>DefaultFailureHandler</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/isInstanceOf.html"><strong>isInstanceOf&lt;T&gt;</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/MatchState.html"><strong>MatchState</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/StringDescription.html"><strong>StringDescription</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/TestFailure.html"><strong>TestFailure</strong></a>
          </h4>
          </div>
          
          <div class="type">
          <h4>
            <a href="matcher/Throws.html"><strong>Throws</strong></a>
          </h4>
          </div>
          
</div>
<div>
<h3>Typedefs</h3>
          <div class="type">
          <h4>
            <a href="matcher/ErrorFormatter.html"><strong>ErrorFormatter</strong></a>
          </h4>
          </div>
          
</div>
        </div>
        <div class="clear"></div>
        </div>
        <div class="footer">
          
        </div>
        <script async src="client-live-nav.js"></script>
        </body></html>
        
